#pragma once

#include "xftp_task.h"

#include <map>

class XFtpServerCmd:public XFtpTask {
public:
    XFtpServerCmd();
    ~XFtpServerCmd();
    virtual bool Init() override;
	virtual void Read(struct bufferevent *bev) override;
	virtual void Event(struct bufferevent *bev, short what) override;
    
    // 注册命令处理对象,不需要考虑线程安全,调用时还未分发到线程
    void Reg(std::string cmd, XFtpTask *call);
private:
    // 注册的处理对象
    std::map<std::string, XFtpTask*> calls;
    // 用来做空间清理
    std::map<XFtpTask*, int> calls_del;
};

